<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

/**
 * 售后站 基类.
 *
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\AfterSalesSite.name", default="fa_after_sales_site"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\AfterSalesSite.poolName"))
 * @DDL(sql="CREATE TABLE `fa_after_sales_site` (
  `id` int(10) unsigned NOT NULL,
  `area_id` int(10) DEFAULT NULL COMMENT '地区id',
  `user_id` int(10) DEFAULT NULL COMMENT '用户',
  `name` varchar(255) DEFAULT NULL COMMENT '地区名',
  `ratio` decimal(3,2) DEFAULT NULL COMMENT '比例',
  `time` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='售后站'", decode="")
 *
 * @property int|null $id 
 * @property int|null $areaId 地区id
 * @property int|null $userId 用户
 * @property string|null $name 地区名
 * @property string|float|int|null $ratio 比例
 * @property int|null $time 创建时间
 */
abstract class AfterSalesSiteBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * id.
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * 地区id.
     * area_id
     * @Column(name="area_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $areaId = NULL;

    /**
     * 获取 areaId - 地区id.
     *
     * @return int|null
     */
    public function getAreaId(): ?int
    {
        return $this->areaId;
    }

    /**
     * 赋值 areaId - 地区id.
     * @param int|null $areaId area_id
     * @return static
     */
    public function setAreaId($areaId)
    {
        $this->areaId = null === $areaId ? null : (int)$areaId;
        return $this;
    }

    /**
     * 用户.
     * user_id
     * @Column(name="user_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $userId = NULL;

    /**
     * 获取 userId - 用户.
     *
     * @return int|null
     */
    public function getUserId(): ?int
    {
        return $this->userId;
    }

    /**
     * 赋值 userId - 用户.
     * @param int|null $userId user_id
     * @return static
     */
    public function setUserId($userId)
    {
        $this->userId = null === $userId ? null : (int)$userId;
        return $this;
    }

    /**
     * 地区名.
     * name
     * @Column(name="name", type="varchar", length=255, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $name = NULL;

    /**
     * 获取 name - 地区名.
     *
     * @return string|null
     */
    public function getName(): ?string
    {
        return $this->name;
    }

    /**
     * 赋值 name - 地区名.
     * @param string|null $name name
     * @return static
     */
    public function setName($name)
    {
        $this->name = null === $name ? null : (string)$name;
        return $this;
    }

    /**
     * 比例.
     * ratio
     * @Column(name="ratio", type="decimal", length=3, accuracy=2, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|float|int|null
     */
    protected $ratio = NULL;

    /**
     * 获取 ratio - 比例.
     *
     * @return string|float|int|null
     */
    public function getRatio()
    {
        return $this->ratio;
    }

    /**
     * 赋值 ratio - 比例.
     * @param string|float|int|null $ratio ratio
     * @return static
     */
    public function setRatio($ratio)
    {
        $this->ratio = null === $ratio ? null : $ratio;
        return $this;
    }

    /**
     * 创建时间.
     * time
     * @Column(name="time", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $time = NULL;

    /**
     * 获取 time - 创建时间.
     *
     * @return int|null
     */
    public function getTime(): ?int
    {
        return $this->time;
    }

    /**
     * 赋值 time - 创建时间.
     * @param int|null $time time
     * @return static
     */
    public function setTime($time)
    {
        $this->time = null === $time ? null : (int)$time;
        return $this;
    }

}
